<template>
  <el-container class="container_boss">
    <el-header style="height: 130px;width: 100%;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
      <div class="header-user">
        <el-avatar icon="el-icon-user-solid"></el-avatar>
      </div>
      <div class="header-user-name">
        <h1>{{userFrom.name}}</h1>
      </div>
    </el-header>
    <el-main class="main_container">
      <el-menu style="display: flex;flex-direction: column;text-align: left">
        <el-menu-item @click="replaceRoute('userOrderList')" style="float: left">
          <i class="el-icon-document"></i>
          <span slot="title">查看订单</span>
        </el-menu-item>
        <el-menu-item @click="replaceRoute('userModify')">
          <i class="el-icon-s-data"></i>
          <span slot="title">修改信息</span>
        </el-menu-item>
        <el-menu-item @click="replaceRoute('userlogin')">
          <i class="el-icon-setting"></i>
          <span slot="title">退出登录</span>
        </el-menu-item>
      </el-menu>
    </el-main>
  </el-container>
</template>

<script>
export default {
  name: "UserMsgMain",
  data(){
    return{
      size:'',
      userFrom:{
        gender:'',
        name:'',
        phone:'',
        telephone:'',
        province:'',
        city:'',
        region:''
      }
    }
  },
  methods:{
    replaceRoute(destination){
      if (destination === 'userlogin'){
        localStorage.removeItem("userManager")
      }
      this.$router.replace({path:destination})
    }
  },
  mounted() {
    let userMsg = JSON.parse(localStorage.getItem("userManager"))
    this.userFrom.gender=userMsg.gender
    this.userFrom.name=userMsg.name
    this.userFrom.phone=userMsg.phone
    this.userFrom.telephone=userMsg.telephone
    this.userFrom.province=userMsg.province
    this.userFrom.city=userMsg.city
    this.userFrom.region=userMsg.region
  }
}
</script>

<style scoped>
.main_container{
margin-top: 60px;
}
.main-select{
  height: 50px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  margin-top: 20px;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
}
</style>
